package com.android.danaobank.adapter;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.android.danaobank.mvp.fragment.MallRecommendFragment;
import com.android.pdd.baseapp.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

public class MallFragmentPagerAdapter extends FragmentPagerAdapter {

    private List<BaseFragment> fragmentList = new ArrayList<>();
    private String[] titles = {"推荐", "礼品", "严选好货", "企服", "酒店", "图书"};

    public MallFragmentPagerAdapter(@NonNull FragmentManager fm) {
        super(fm);
        fragmentList.add(new MallRecommendFragment());
        fragmentList.add(new MallRecommendFragment());
        fragmentList.add(new MallRecommendFragment());
        fragmentList.add(new MallRecommendFragment());
        fragmentList.add(new MallRecommendFragment());
        fragmentList.add(new MallRecommendFragment());
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    }
}
